<link type="text/css" href="<?=$base_url;?>images/js/jqueryui/css/smoothness/jquery-ui-1.8.24.custom.css" rel="stylesheet" />
<script type="text/javascript" src="<?=$base_url;?>images/js/jqueryui/js/jquery-ui-1.8.24.custom.min.js"></script>
<script type="text/javascript" src="<?=$base_url;?>images/js/jquery.validate.js?v1"></script>
<script type="text/javascript">
$().ready(function(){
    regis_init();
    regis_setValidateStep();
});
function regis_init()
{
    $.validator.messages.required = "Vui lòng nhập ô này";
    $.validator.messages.email = "Email này chưa đúng.";
    //at start step 1 is actived
    
    $("#btnConfirmStep2").click(function(){
        if($("#frmRegisterStep2").valid())
        {
            $("#frmRegisterStep2").submit();
        }
        return false;
    });
    $(":input[name='regis_birthday']").datepicker({
        showOn : "both",
        buttonImage : '<?=$base_url;?>images/calendar.gif',
        dateFormat : "dd/mm/yy",
        changeMonth : true,
        changeYear : true,
        buttonImageOnly : true,
        firstDay:1
    })
   
    
}



function regis_setValidateStep()
{
    
    $("#frmRegisterStep2").validate({
       rules:{
            regis_name:{
                required:true
            },
            
            regis_username:{
                required:true
            },
            regis_sex:{
                required:true
            },
            regis_password:{
                minlength: 6
            },
            regis_confirmPassword:{
                equalTo: ':input[name="regis_password"]'
            },
            regis_email:{
                required:true,
                email:true
            },
            regis_mobilePhone:{
                required:true
            },
            regis_address:{
                required:true
            },
            captcha_code:{
                required: true         
            }
       } ,
       messages:{
            regis_username:{
                remote:"Tên đăng nhập này đã được sử dụng."
            },
            regis_email:{
                remote:"Email này đã được sử dụng."
            },
            regis_confirmPassword:{
                equalTo:"Nhập trùng với mật khẩu."
            }
       }
    });
}



</script>
<div>
	<?php $this->load->view('front/includes/breadcrumb') ?>
	<div class="main_separate"></div>
	<h2 class="h2_register">Tài khoản</h2>
 
    <div class="registerStep2 registerStep" >
        <div class="regis_box">
    		<div class="regis_box_title">chỉnh sửa  thông tin</div>
    		<div class="regis_box_gray"><center>Mục có dấu (*) là những mục bắt buộc nhập</center></div>
    		
    		<br /><br />
    		<form accept-charset="utf-8" method="post" id="frmRegisterStep2" action="<?=base_url()?>tai-khoan"  >
    			<div class="regis_line">
    				<div class="fl regis_line_txt">Họ và tên <font color="red">(*)</font></div>
    				<div class="fl"><input type="text"  name="regis_name" value="<?=$customer->name;?>" /></div>
    				<div class="clr"></div>
    			</div>
    			
                <div class="regis_line">
                    <div class="fl regis_line_txt">Giới tính <font color="red">(*)</font></div>
    				<div class="fl">	
    					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="regis_sex" <?php if($customer->sex == 'male') echo 'checked="checked"';?> value="male" />Nam 
    					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="regis_sex" <?php if($customer->sex == 'female') echo 'checked="checked"';?> value="female" />Nữ
    				</div>
                    <div class="clr"></div>
                </div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">ID tên tài khoản <font color="red">(*)</font></div>
    				<div class="fl "><input type="text" disabled="disabled" name="regis_username" value="<?=$customer->username;?>" /></div>
    				<div class="clr"></div>
    			</div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">Mật khẩu <font color="red">(*)</font></div>
    				<div class="fl "><input type="password" name="regis_password"  value="" /></div>
    				<div class="clr"></div>
    			</div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">Nhập lại mật khẩu <font color="red">(*)</font></div>
    				<div class="fl "><input type="password" name="regis_confirmPassword"  value="" /></div>
    				<div class="clr"></div>
    			</div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">Email <font color="red">(*)</font></div>
    				<div class="fl "><input type="text" disabled="disabled" name="regis_email"  value="<?=$customer->email;?>" /></div>
    				<div class="clr"></div>
    			</div>
                
                <div class="regis_line">
    				<div class="fl regis_line_txt">Điện thoại bàn</font></div>
    				<div class="fl "><input type="text" name="regis_homePhone"  value="<?=$customer->homePhone;?>" /></div>
    				<div class="clr"></div>
    			</div>
                <div class="regis_line">
    				<div class="fl regis_line_txt">Điện thoại di động <font color="red">(*)</font></div>
    				<div class="fl "><input type="text" name="regis_mobilePhone"  value="<?=$customer->mobilePhone;?>" /></div>
    				<div class="clr"></div>
    			</div>
 			
    			<div class="regis_line">
    				    <div class="fl regis_line_txt">Địa chỉ <font color="red">(*)</font></div>
    				
    					<div class="fl "><input type="text" name="regis_address" value="<?=$customer->address;?>" /></div>
    					<div class="clr"></div>
    				<div class="clr"></div>
    			</div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">Mã bảo vệ <font color="red">(*)</font></div>
    				<div class="fl ">
    					<div class="fl">
    						<img id="captcha" src="<?=$base_url;?>securimage/securimage_show.php" alt="CAPTCHA Image" />
    					</div>
    					<div class="fl" style="padding-left: 5px;">
    						<div><a href="#" onclick="document.getElementById('captcha').src = '<?=$base_url;?>/securimage/securimage_show.php?' + Math.random(); return false">[ <?=lang('other_img')?> ]</a></div>
    						<div style="height: 10px;"></div>
    						<input type="text" name="captcha_code"  maxlength="6" style="display: block;" />
                            
    					</div>			
    					<div class="clr"></div>
    				</div>
    				<div class="clr"></div>
    			</div>
    			<div class="regis_line">
    				<div class="fl regis_line_txt">&nbsp;</div>
    				<div class="fl "><input class="chk" type="checkbox" <?php if($customer->isReceiverEmail == '1') echo 'checked="checked"';?>  name="regis_isReceiverEmail" value="1">Đồng ý nhận email từ website</div>
    				<div class="clr"></div>
    			</div>
    			
    			
    			<br />
                <?php if(isset($msg) && $msg!="" ){ ?>
					<div style="color:red"><?=$msg;?></div>
				<?php } ?>
    			<div class="regis_btn">
    				<input type="image" id="btnConfirmStep2" src="<?=base_url()?>images/btn_confirm.png" />
    				<input type="image" id="btnCleanStep2" src="<?=base_url()?>images/btn_clean.png" />
    			</div>
    		</form>
    		<div class="clr"></div>
    	</div>
    </div>
    
</div>

